Explore

Column

Filters

When

Where

What

Interactive table

Column

Interactive map

Information

Deer

Roebuck by Don Sutherland (CC BY-NC-ND 2.0)

About

What is this?

This tool is for exploring data from the National Deer Vehicle Collisions Project. Find out more about collisions from Scottish Natural Heritage.

The tool is under construction so functionality isn’t great. Note that the data are a random sample of 50 points within each year from 2000 to 2017. The original dataset has over 22000 incidents.

This tool was made by Matt Dray (@mattdray on Twitter and matt-dray on GitHub).

How to use

Filters (top-left pane of the ‘Explore’ tab)

From the dropdown menus in the filter section you can select one or more:

  • local authorities
  • road number
  • month
  • deer species (not that most are unknown)

Deselect an option by clicking it again or by deleting it from the selectino list using your backspace key.

Interactive map (right pane)

You can:

  • click to grab and drag the map around
  • zoom with the ‘+’ and ‘–’ buttons (top-left) or with your mouse’s scroll wheel
  • click a marker to reveal a popup with information about that school
  • click the button showing a broken square (top-left under the zoom options) to select points on the map using a draggable window (click and hold the grid icon in the upper left) and resizeable (click and drag the white boxes in each corner)
Interactive table (lower-left pane)

You can:

  • click an entry to highlight that point on the map (deselect by re-clicking)
  • sort the columns (ascending and descending) by clicking on the column header
  • change which columns are visible by clicking the Column visibility button
  • click ‘CSV’ or ‘Excel’ to download the filtered data to a .csv file or a .xlsx
  • see how many entries remain after filtering in the bottom-left, where it says ‘Showing X to Y of Z entries’

Tools

Code

R and RStudio were used.

The main packages used were:

The code for this tool is available from github.com/matt-dray/scot-deer-collision.

Session info

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bindrcpp_0.2.2        DT_0.5                leaflet_2.0.2        
 [4] crosstalk_1.0.0       flexdashboard_0.5.1.1 sf_0.7-2             
 [7] lubridate_1.7.4       janitor_1.1.1         stringr_1.3.1        
[10] dplyr_0.7.8          

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0       later_0.7.5      pillar_1.3.0     compiler_3.5.1  
 [5] bindr_0.1.1      class_7.3-14     tools_3.5.1      digest_0.6.18   
 [9] jsonlite_1.5     evaluate_0.11    tibble_1.4.2     pkgconfig_2.0.2 
[13] rlang_0.3.0.1    shiny_1.2.0      DBI_1.0.0        yaml_2.2.0      
[17] xfun_0.3         e1071_1.7-0      knitr_1.21       htmlwidgets_1.3 
[21] classInt_0.3-1   grid_3.5.1       tidyselect_0.2.4 snakecase_0.9.2 
[25] glue_1.3.0       R6_2.3.0         rmarkdown_1.11   purrr_0.2.5     
[29] magrittr_1.5     promises_1.0.1   htmltools_0.3.6  units_0.6-2     
[33] assertthat_0.2.0 xtable_1.8-3     mime_0.6         httpuv_1.4.5    
[37] stringi_1.2.4    lazyeval_0.2.1   crayon_1.3.4